package com.qf.bbapi.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.qf.bbapi.type.OrderFlagType;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.io.Serializable;

/**
 * (TOrder)实体类
 *
 * @author makejava
 * @since 2022-07-02 21:19:29
 */

@Data
@NoArgsConstructor
@TableName(value = "t_order")
public class Order implements Serializable {
    private static final long serialVersionUID = 228706819114345000L;
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 用户id
     */
    private Long uid;

    /**
     * 订单编号
     */
    @TableField("order_no")
    private String orderNo;
    /**
     * 总价
     */
    @TableField("total_price")
    private Double totalPrice;
    /**
     * 状态
     */
    private Integer flag;
    /**
     * 店id
     */
    @TableField("shop_id")
    private Integer shopId;
    /**
     * 商品数量
     */
    @TableField("total_num")
    private Integer totalNum;
    /**
     * 下单时间
     */
    private Date ctime;
    
    private String notes;
    @TableField("address_id")
    private Integer addressId;

    public Order(Long uid, Double totalPrice, Integer totalNum, Integer addressId) {
        this.uid = uid;
        this.orderNo = "LT" + System.currentTimeMillis();
        this.totalPrice = totalPrice;
        this.flag = OrderFlagType.未支付.getValue();
        this.shopId = 1;
        this.totalNum = totalNum;
        this.ctime = new Date();
        this.notes = "打包带走";
        this.addressId = addressId;
    }


}

